import React from 'react'
import { Renderer } from 'amis'

/**
 * 自动序号列
 */
class IndexColumn extends React.Component<any> {
	render = () => {
		const total = this.props.scope.total
		const currentPage = this.props.scope.page - 1
		const pageSize = this.props.scope.size || this.props.pageSize || 10
		const rowIndex = this.props.rowIndex
		const value = currentPage * pageSize + rowIndex + 1
		return <p>{value}</p>
	}
}

Renderer({
	type: 'ace-col-index',
	weight: 100,
})(IndexColumn)
export default IndexColumn
